package com.yndsoft.jc.ui.xiaoyao;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;

/**
 * Created by Administrator on 2016-08-31.
 */
public class XYGridView extends GridView {
    public XYGridView(Context context) {
        super(context);
    }

    public XYGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public XYGridView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        //根据模式计算每个child的高度和宽度
        //Integer.MAX_VALUE >> 2,如果不设置，系统默认设置是显示两条
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);
    }
}
